/*
 * @Author: robinbird && 1197737573@qq.com
 * @Date: 2023-10-17 10:34:40
 * @LastEditors: robinbird && 1197737573@qq.com
 * @LastEditTime: 2023-10-17 10:50:32
 * @FilePath: /ws_20376379/src/my_first_package/src/my_pub.cpp
 * @Description: 
 * 
 */
#include <ros/ros.h>
#include <std_msgs/Float64.h>
#include <cmath>
#define PI acos(-1.0)

int main(int argc, char ** argv)
{
    ros::init(argc,argv,"my_pub");
    ros::NodeHandle nh;
    ros::Publisher my_pub = nh.advertise<std_msgs::Float64>("topic1",1);
    ros::Rate rate(1);
    std_msgs::Float64 pub_msg;
    pub_msg.data = 0.0;
    double ang = 0.0;
    while (ros::ok())
    {   
        ang+= 0.1;
        //三角函数
        pub_msg.data = sin(ang);
        my_pub.publish(pub_msg);
        ROS_INFO("ang: %lf, sin:%lf\n",ang,pub_msg.data);
        rate.sleep();
    }
    

    return 0;
}